﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using kim.Common;
using System.Text;
namespace kim.Web.Admin
{
    public partial class indexpage : UI.ManagePage
    {
        public StringBuilder strTxt1=new StringBuilder();
        public StringBuilder strTxt2 = new StringBuilder();
        protected void Page_Load(object sender, EventArgs e)
        {
            lblAdminName.Text = GetAdminInfo().AdminName;
            strMenu();
        }

      

        protected void lbtnExit_Click(object sender, EventArgs e)
        {
            Session.Contents.Remove(KIMKeys.SESSION_ADMIN_INFO);
            Utils.WriteCookie("AdminName", "KIM", -14400);
            Utils.WriteCookie("AdminPwd", "KIM", -14400);
           
            Response.Redirect("Login.aspx");
        }
        protected void lbtnUser_Click(object sender, EventArgs e)
        {
            Response.Redirect("indexpage.aspx");
        }
        private void strMenu() {
            List<Model.ListTypea> moTopList = new BLL.ListTypea().GetModelList("IsParent=0");
            int i=1;
            if (moTopList.Count > 0)
            {

                foreach (Model.ListTypea topMo in moTopList)
                {
                    strTxt1.AppendFormat("<li onclick=\"tabs({0});\"><a href=\"{1}\" target=\"sysMain\">",i,topMo.ListUrl);
                    strTxt1.AppendFormat("<span>{0}</span></a></li>",topMo.NeName);
                    i++;
                    List<Model.ListTypea> moList = new BLL.ListTypea().GetModelList("IsParent=" + topMo.ListID);
                    if (moList.Count > 0)
                    {
                        strTxt2.Append("<div class=\"left_menu\"><ul>");

                        foreach (Model.ListTypea mo in moList)
                        {
                            strTxt2.AppendFormat("<li><a href=\"{0}\" target=\"sysMain\">{1}</a></li>",mo.ListUrl,mo.NeName);
                        }
                        strTxt2.Append("</ul></div >");
                    }
                }
            }
        }
    }
}